<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>邮件格式</title>
</head>

<style>
    * {
        list-style: none;
    }
</style>

<body>
    <div class="box">
        <input type="text" class="check_box"><button>检测</button>
        <ul class="show_list">

        </ul>
    </div>
</body>
<script>
    var btn = document.querySelector("button");
    var showList = document.querySelector(".show_list");
    btn.addEventListener("click", function() {
        var checkBoxArry = document.querySelector(".check_box");
        var check = checkBoxArry.value.indexOf("@");
        var checks = checkBoxArry.value.indexOf(".com");
        if (check == -1 || checks == -1) {
            showList.innerHTML = "<li>你的邮件格式不对</li>";

        } else {
            showList.innerHTML = "<li>你的邮件格式正确</li>";
        }

    });
</script>

</html>